<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:include href="core\form.xsl"/>
	<xsl:include href="core\level0.xsl"/>
	
<xsl:template match="page">
	<xsl:call-template name="page_content"/>
</xsl:template>

<xsl:template name="page_content">
<table cellspacing="0" cellpadding="4" width="100%">
	<tr><td align="center">
<font color="#666666"><b>Premium Insurance Companies List</b></font> &#160;|&#160; <a href="main.asp?-insurance_companies_search.asp-=&amp;insurance_companies_list_frm_auto=1&amp;company_name=&amp;states_id=61&amp;countries_id=&amp;submit.x=80&amp;submit.y=7" class="linkbold" title="All Insurance Companies"><font color="{$color_main_first1}">All Insurance Companies</font></a> &#160;|&#160; <a href="insurance_companies_search.asp" class="linkbold" title="Insurance Company Search"><font color="{$color_main_first1}">Insurance Company Search</font></a>
	</td></tr>
</table>
	<xsl:call-template name="title_page">
		<xsl:with-param name="titleText">
			<xsl:choose>
					<xsl:when test="ic='all'">All Insurance Companies List</xsl:when>
			  		<xsl:otherwise>Premium Insurance Services</xsl:otherwise>
					</xsl:choose>
		</xsl:with-param>
	</xsl:call-template>
	
	<!-- <table border="0" cellspacing="0" cellpadding="4" width="100%">
	<tr>
		<td align="center">
			<xsl:choose>
				<xsl:when test="ic='all'"><a href="premium_insurance_companies.asp"><font color="{$color_main_first1}">Premium List</font></a></xsl:when>
		  		<xsl:otherwise><a href="insurance_companies_search.asp"><font color="{$color_main_first1}">All Insurance Companies</font></a></xsl:otherwise>
	    	</xsl:choose>
	  	</td>
	  	<td><xsl:call-template name="spacer_v"><xsl:with-param name="height">22</xsl:with-param></xsl:call-template></td>
	</tr>
	</table> -->

  	<br/>
	<table width="100%">
	<xsl:choose>
	<xsl:when test="ic='all'">
		<xsl:variable name="numCols" select="3"/>
		<xsl:apply-templates mode="multiColumn" select="insurance_companies/row/logo">
			<xsl:with-param name="numCols" select="$numCols"/>
			<xsl:with-param name="nodes" select="insurance_companies/row/logo"/>
    	</xsl:apply-templates>
	</xsl:when>
	<xsl:otherwise>
	    <xsl:for-each select="insurance_companies/row">
	 		<xsl:variable name="src">
		    	<xsl:value-of select="$media_path"/>
		    	<xsl:value-of select="logo"/>
  		  	</xsl:variable>
	<tr>
		<td valign="top">
		    <xsl:choose>
			<xsl:when test="position() mod 2 = 0">
				<table width="100%" cellpadding="5" cellspacing="2">
				   <tr>
		        	<td valign="top" colspan="2"><hr width="100%" size="1" noshade="true"  color="{$header_bg_color}"/></td>
				</tr>
			    <tr>
		        	<td valign="middle" width="460">
						<xsl:value-of select="note" disable-output-escaping="yes"/>
		            </td>
		            <td valign="top" align="center">
						<xsl:if test="string-length(logo)>4">
				            <xsl:choose>
			            	<xsl:when test="contains($src,'jpg') or contains($src,'JPG') or contains($src,'jpeg') or contains($src,'JPEG')">
								<xsl:choose>
								<xsl:when test="id=0">
				            	<a href="{url}" target="blank">
					              	<img border="0" vspace="2" hspace="4">
					                	<xsl:attribute name="src"><xsl:value-of select="$src" disable-output-escaping="yes"/></xsl:attribute>
						                <xsl:attribute name="alt"><xsl:value-of select="alt" disable-output-escaping="yes"/></xsl:attribute>
									</img>
				                </a>
								</xsl:when>
								<xsl:otherwise>
				            	<a href="insurance_company_details.asp?companies_id={id}">
					              	<img border="0" vspace="2" hspace="4">
					                	<xsl:attribute name="src"><xsl:value-of select="$src" disable-output-escaping="yes"/></xsl:attribute>
						                <xsl:attribute name="alt"><xsl:value-of select="name" disable-output-escaping="yes"/></xsl:attribute>
									</img>
				                </a>
								</xsl:otherwise>
								</xsl:choose>
			              	</xsl:when>
			              	<xsl:otherwise><!-- No Image --></xsl:otherwise>
							</xsl:choose>
						</xsl:if>
		              	<br/>
		            </td>
				</tr>
				   <tr>
		        	<td valign="top" colspan="2"><hr width="100%" size="1" noshade="true"  color="{$header_bg_color}"/></td>
				</tr>
			    </table>
			</xsl:when>
			<xsl:otherwise>
			    <table width="100%" cellpadding="5" cellspacing="2">
				<tr>
		        	<td valign="top" align="center">
		            	<xsl:if test="string-length(logo)>4">
			            	<xsl:choose>
			              	<xsl:when test="contains($src,'jpg') or contains($src,'JPG')  or contains($src,'jpeg') or contains($src,'JPEG')">
								<xsl:choose>
								<xsl:when test="id=0">
				            	<a href="{url}" target="blank">
					              	<img border="0" vspace="2" hspace="4">
					                	<xsl:attribute name="src"><xsl:value-of select="$src" disable-output-escaping="yes"/></xsl:attribute>
						                <xsl:attribute name="alt"><xsl:value-of select="alt" disable-output-escaping="yes"/></xsl:attribute>
									</img>
				                </a>
								</xsl:when>
								<xsl:otherwise>
								<a href="insurance_company_details.asp?companies_id={id}">
				              		<img border="0" vspace="2" hspace="4">
						                <xsl:attribute name="src"><xsl:value-of select="$src" disable-output-escaping="yes"/></xsl:attribute>
						                <xsl:attribute name="alt"><xsl:value-of select="name" disable-output-escaping="yes"/></xsl:attribute>
									</img>
			                	</a>
								</xsl:otherwise>
								</xsl:choose>
			              	</xsl:when>
			              	<xsl:otherwise><!-- No Image --></xsl:otherwise>
			            	</xsl:choose>
		              	</xsl:if>
		              	<br/>
		            </td>
		            <td valign="middle" width="460">
						<xsl:value-of select="note" disable-output-escaping="yes"/>
		            </td>
				</tr>
			    </table>
			</xsl:otherwise>
			</xsl:choose>
		</td>
	</tr>
    <xsl:if test="position() != last()"><tr><td valign="center"></td></tr></xsl:if>
    	</xsl:for-each>
    </xsl:otherwise>
    </xsl:choose>
	</table>
	<xsl:apply-templates select="Pager"/>
</xsl:template>

<!-- <xsl:template match="row/logo" mode="multiColumn">
	<xsl:param name="nodes" select="/.."/>
  	<xsl:param name="numCols" select="1"/>
  	<xsl:variable name="vCurPosition" select="position()"/>
  	<xsl:choose>
    <xsl:when test="$vCurPosition mod (2 * $numCols) = 1">
    	<tr bgcolor="{$bgcolor_light}">
        	<xsl:apply-templates mode="normal" select="$nodes[position() >= $vCurPosition and position() &lt; $vCurPosition + $numCols]"/>
		</tr>
	</xsl:when>
    <xsl:when test="$vCurPosition mod $numCols = 1">
		<tr>
        	<xsl:apply-templates mode="normal" select="$nodes[position() >= $vCurPosition and position() &lt; $vCurPosition + $numCols]"/>
		</tr>
	</xsl:when>
	</xsl:choose>
</xsl:template>

<xsl:template match="row/name" mode="normal">
	<xsl:if test="string-length(../logo)>4">
	    <xsl:choose>
	    <xsl:when test="contains(../logo,'jpg') or contains(../logo,'JPG') or contains(../logo,'jpeg') or contains(../logo,'JPEG')">
		    <a href="finance_company_group.asp?c={../id}">
				<img border="0" vspace="2" hspace="4">
			    	<xsl:attribute name="src">
	              		<xsl:value-of select="$media_path"/>
						<xsl:value-of select="../logo"/>
	            	</xsl:attribute>
			    	<xsl:attribute name="alt">
				  		<xsl:value-of select="." disable-output-escaping="yes"/>
			    	</xsl:attribute>
			  	</img>
		    </a>
		</xsl:when>
		<xsl:otherwise>No Image</xsl:otherwise>
	    </xsl:choose>
  	</xsl:if>
  	<br/>
  	<a href="finance_company_group.asp?c={../id}"><xsl:value-of select="." disable-output-escaping="yes"/></a>
</xsl:template>

<xsl:template match="row/logo" mode="normal">
	<td>
		<xsl:choose>
		<xsl:when test="contains(../logo,'jpg') or contains(../logo,'JPG') or contains(../logo,'jpeg') or contains(../logo,'JPEG')">
			<a href="finance_company_group.asp?fc_id={../id}">
				<img border="0" vspace="2" hspace="4">
					<xsl:attribute name="src">
						<xsl:value-of select="$media_path"/>
						<xsl:value-of select="../logo"/>
					</xsl:attribute>
					<xsl:attribute name="alt"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:attribute>
			  	</img>
			</a>
		</xsl:when>
		<xsl:otherwise>No Image</xsl:otherwise>
		</xsl:choose>
		<br/>
		<a href="finance_company_group.asp?fc_id={../id}"><xsl:value-of select="../name" disable-output-escaping="yes"/></a><br/>
		<xsl:if test="string-length(../curr_rate)>0">Curr rate: <xsl:value-of select="../curr_rate"/></xsl:if>
	</td>
</xsl:template> -->

</xsl:stylesheet>
